<template>
  <div class="type_head">
    <div class="btnlist">
      <button :style="{ background: '#8AA4AF' }" @click="back" v-if="flag">
        <svg-icon icon-class="back"></svg-icon>返回上级
      </button>
      <button :style="{ background: '#55CA7D' }" @click="add">
        <svg-icon icon-class="jiahao"></svg-icon>添加分类
      </button>
      <button :style="{ background: '#FF5157' }" @click="allDelete">
        <svg-icon icon-class="delete"></svg-icon>批量删除
      </button>
    </div>
    <div class="search">
      <span>分类名称</span>
      <input type="text" />
      <button>查询</button>
    </div>
  </div>
</template>

<script>
export default {
  props: ["flag"],
  methods: {
    //返回上一级
    back() {
      this.$router.go(-1)
    },
    //添加分类
    add() {
      this.$router.push('/commodity_manager/typeAdd')
    },
    //批量删除
    allDelete() {
      console.log(3333);
    },
  },
};
</script>

<style scoped lang='scss'>
.type_head {
  width: 100%;
  min-width: 1200px;
  height: 70px;
  border: 1px solid #e5e5e5;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  .btnlist {
    button {
      width: 150px;
      height: 35px;
      color: #fff;
      font-size: 16px;
      margin-right: 18px;
      border: none;
      border-radius: 5px;
      cursor: pointer;
      svg {
        color: #fff;
        font-size: 16px;
        margin-right: 8px;
      }
    }
    button:hover {
      opacity: 0.8;
    }
  }
  .search {
    span {
      font-size: 16px;
      margin-right: 6px;
      color: #101010;
    }
    input {
      width: 250px;
      height: 30px;
      margin-right: 10px;
    }
    button {
      width: 90px;
      height: 35px;
      background: #55ca7d;
      border: none;
      border-radius: 3px;
      color: #fff;
    }
  }
}
</style>